home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / AppsToGo / AppsToGo.src / AppsToGo.Changes / DTS.Draw / Window.c.df < prev   
Encoding:
Text File  |  1993-06-18  |  27.1 KB  |  744 lines  |  [TEXT/MPS ]

  1. File #1: b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c
  2. File #2: a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c
  3.  
  4. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 7; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 7)
  5. ** Copyright © 1990-1992 Apple Computer, Inc.
  6.  
  7. ** Copyright © 1990-1993 Apple Computer, Inc.
  8.  
  9.  
  10. Extra lines in 2nd before 11 in 1st (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line Δ11; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 11:18)
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19.  
  20.  
  21. Extra lines in 2nd before 85 in 1st (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line Δ85; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 93:95)
  22. static void        DrawPageGrid(void);
  23.  
  24. #define kDataAreaPadding 0
  25.  
  26.  
  27. Extra lines in 1st before 98 in 2nd (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 87; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line Δ98)
  28.  
  29.  
  30.  
  31. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 207:209; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 217:223)
  32.         else if (!shiftMod)                    /* No object was clicked on, */
  33.             DoTreeSelect(root, SELECTOFF);    /* so if not a shift-click,  */
  34.                                             /* deselect everything.      */
  35.  
  36.         else {                                    /* No object was clicked on... */
  37.  
  38.             if (!shiftMod)                            /* If not a shift-click, */
  39.                 DoTreeSelect(root, SELECTOFF);        /* deselect everything.  */
  40.  
  41.             AddOrSizeObj(frHndl, hitObj, &click);    /* Do extend select. */
  42.         }
  43.  
  44.  
  45. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 369; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 383)
  46.     LayerObj        windowLayer, backLayer;
  47.  
  48.     LayerObj        wlyr, blyr;
  49.  
  50.  
  51. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 383; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 397)
  52.     NewLayer(&windowLayer, nil, WindowLayerProc, (*frHndl)->fileState.window, 0, (long)&drawInfo);
  53.  
  54.     NewLayer(&wlyr, nil, WindowLayerProc, (*frHndl)->fileState.window, 0, (long)&drawInfo);
  55.  
  56.  
  57. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 386; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 400)
  58.     NewLayer(&backLayer, windowLayer, WorkLayerProc, nil, 0, (long)&drawInfo);
  59.  
  60.     NewLayer(&blyr, wlyr, WorkLayerProc, nil, 0, (long)&drawInfo);
  61.  
  62.  
  63. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 389; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 403)
  64.     InvalLayer(windowLayer, GetEffectiveDstRect(windowLayer), false);
  65.  
  66.     InvalLayer(wlyr, GetEffectiveDstRect(wlyr), false);
  67.  
  68.  
  69. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 392; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 406)
  70.     UpdateLayer(windowLayer);
  71.  
  72.     UpdateLayer(wlyr);
  73.  
  74.  
  75. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 397; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 411)
  76.     DisposeThisAndBelowLayers(windowLayer);
  77.  
  78.     DisposeThisAndBelowLayers(wlyr);
  79.  
  80.  
  81. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 428; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 442:444)
  82.     OSErr    err;
  83.  
  84.     OSErr        err;
  85.     Rect        rct;
  86.     TreeObjHndl    root;
  87.  
  88.  
  89. Extra lines in 2nd before 431 in 1st (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line Δ431; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 447:450)
  90.  
  91.     rct = GetDataArea(root = (*frHndl)->d.doc.root);
  92.     SetDataArea(root, rct.right, rct.bottom);
  93.  
  94.  
  95.  
  96. Extra lines in 2nd before 519 in 1st (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line Δ519; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 539:540)
  97.     TreeObjHndl    root;
  98.     Rect        rct;
  99.  
  100.  
  101. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 521:526; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 543:550)
  102.  
  103.     if (!afterUndo)            /* Before an undo operation we deselect everything. */
  104.         DoTreeSelect((*frHndl)->d.doc.root, SELECTOFF);
  105.             /* Only what was undone should end up selected. */
  106.  
  107.     if (afterUndo) {
  108.  
  109.     root   = (*frHndl)->d.doc.root;
  110.  
  111.     if (!afterUndo)                            /* Before an undo operation we deselect everything. */
  112.         DoTreeSelect(root, SELECTOFF);        /* Only what was undone should end up selected. */
  113.  
  114.     if (afterUndo) {
  115.         rct = GetDataArea(root);
  116.         SetDataArea(root, rct.right, rct.bottom);
  117.  
  118.  
  119. Extra lines in 2nd before 684 in 1st (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line Δ684; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 708:710)
  120.         case mOther:
  121.             redrawMenuBar = DoAdjustOtherMenu(window);
  122.             break;
  123.  
  124.  
  125. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 889:911; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 916:935)
  126. void    DoGroup(FileRecHndl frHndl)
  127. {
  128.     TreeObjHndl    root, group, child;
  129.     short        gnum, cnum;
  130.     Rect        groupRct;
  131.  
  132.     NewDocumentUndo(frHndl);
  133.  
  134.     root = (*frHndl)->d.doc.root;
  135.     for (gnum = 0; gnum < (*root)->numChildren; ++gnum)
  136.         if (DoTreeObjMethod(GetChildHndl(root, gnum), GETSELECTMESSAGE, 0)) break;
  137.  
  138.     if (!(group = NewChild(GROUP_EDIT, root, gnum, GROUPOBJ, 0))) return;
  139.  
  140.     groupRct = GetSelectedArea(root);
  141.     for (cnum = (*root)->numChildren - 1; cnum > gnum; --cnum) {
  142.         if (DoTreeObjMethod(child = GetChildHndl(root, cnum), GETSELECTMESSAGE, 0)) {
  143.             DoTreeObjMethodClipped(child, SETSELECTMESSAGE, SELECTOFF);
  144.             MoveChild(GROUP_EDIT, root, cnum, group, 0);
  145.         }
  146.     }
  147.  
  148.     mDerefGroup(group)->group = groupRct;
  149.  
  150. Rect    GetDataArea(TreeObjHndl root)
  151. {
  152.     TreeObjHndl    child;
  153.     short        cnum;
  154.     Rect        areaRct, rct;
  155.     Boolean        first;
  156.  
  157.     SetRect(&areaRct, 0, 0, 0, 0);
  158.     for (first = true, cnum = (*root)->numChildren; cnum;) {
  159.         child = GetChildHndl(root, --cnum);
  160.         DoTreeObjMethod(child, GETBBOXMESSAGE, (long)&rct);
  161.         if (!EmptyRect(&rct)) {
  162.             if (first) {
  163.                 areaRct = rct;
  164.                 first   = false;
  165.             }
  166.             else UnionRect(&areaRct, &rct, &areaRct);
  167.         }
  168.     }
  169.     return(areaRct);
  170.  
  171.  
  172. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 921:940; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 945:959)
  173. void    DoUngroup(FileRecHndl frHndl)
  174. {
  175.     TreeObjHndl    root, group;
  176.     short        gnum, cnum;
  177.  
  178.     NewDocumentUndo(frHndl);
  179.  
  180.     root = (*frHndl)->d.doc.root;
  181.     for (gnum = (*root)->numChildren; gnum;) {
  182.         if (DoTreeObjMethod(group = GetChildHndl(root, --gnum), GETSELECTMESSAGE, 0)) {
  183.             if ((*group)->type == GROUPOBJ) {
  184.                 DoTreeSelect(group, SELECTOFF);
  185.                 for (cnum = (*group)->numChildren; cnum;) {
  186.                     MoveChild(UNGROUP_EDIT, group, --cnum, root, gnum + 1);
  187.                     DoTreeSelect(GetChildHndl(root, gnum + 1), SELECTON);
  188.                 }
  189.                 DisposeChild(UNGROUP_EDIT, root, gnum);
  190.             }
  191.         }
  192.     }
  193.  
  194. void    SetDataArea(TreeObjHndl root, short h, short v)
  195. {
  196.     if (h != kwNoChange) {
  197.         h /= (7 * 72);
  198.         ++h;
  199.         h *= (7 * 72);
  200.     }
  201.  
  202.     if (v != kwNoChange) {
  203.         v /= (10 * 72);
  204.         ++v;
  205.         v *= (10 * 72);
  206.     }
  207.  
  208.     SetDocSize(mDerefRoot(root)->frHndl, h, v);
  209.  
  210.  
  211. Extra lines in 1st before 965 in 2nd (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 946:947; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line Δ965)
  212. /*****************************************************************************/
  213. /*****************************************************************************/
  214.  
  215.  
  216. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 952:973; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 969:1059)
  217. void    AddOrSizeObj(FileRecHndl frHndl, TreeObjHndl hndl, ClickInfo *click)
  218. {
  219.     TreeObjHndl        root;
  220.     WindowPtr        window;
  221.     short            cnum, h, w;
  222.     LayerObj        windowLayer, workLayer, backLayer;
  223.     Rect            oldRct, newRct, rct;
  224.     OSErr            err;
  225.     LayerDrawInfo    drawInfo;
  226.     Boolean            adding, tool, keepTool, newTool;
  227.  
  228.     NewDocumentUndo(frHndl);
  229.  
  230.     root   = (*frHndl)->d.doc.root;
  231.     window = (*frHndl)->fileState.window;
  232.  
  233.     tool     = GetTool();
  234.     keepTool = GetToolPersistence();
  235.     adding = newTool = false;
  236.     if (!hndl) {        /* If hndl == nil, then we are adding a new object. */
  237.         adding = true;
  238.         DoTreeSelect(root, SELECTOFF);        /* Turn off all old selections. */
  239.  
  240. void    DoGroup(FileRecHndl frHndl)
  241. {
  242.     TreeObjHndl    root, group, child;
  243.     short        gnum, cnum;
  244.     Rect        groupRct;
  245.  
  246.     NewDocumentUndo(frHndl);
  247.  
  248.     root = (*frHndl)->d.doc.root;
  249.     for (gnum = 0; gnum < (*root)->numChildren; ++gnum)
  250.         if (DoTreeObjMethod(GetChildHndl(root, gnum), GETSELECTMESSAGE, 0)) break;
  251.  
  252.     if (!(group = NewChild(GROUP_EDIT, root, gnum, GROUPOBJ, 0))) return;
  253.  
  254.     groupRct = GetSelectedArea(root);
  255.     for (cnum = (*root)->numChildren - 1; cnum > gnum; --cnum) {
  256.         if (DoTreeObjMethod(child = GetChildHndl(root, cnum), GETSELECTMESSAGE, 0)) {
  257.             DoTreeObjMethodClipped(child, SETSELECTMESSAGE, SELECTOFF);
  258.             MoveChild(GROUP_EDIT, root, cnum, group, 0);
  259.         }
  260.     }
  261.  
  262.     mDerefGroup(group)->group = groupRct;
  263. }    
  264.  
  265.  
  266.  
  267. /*****************************************************************************/
  268.  
  269.  
  270.  
  271. #pragma segment DrawDoc
  272. void    DoUngroup(FileRecHndl frHndl)
  273. {
  274.     TreeObjHndl    root, group;
  275.     short        gnum, cnum;
  276.  
  277.     NewDocumentUndo(frHndl);
  278.  
  279.     root = (*frHndl)->d.doc.root;
  280.     for (gnum = (*root)->numChildren; gnum;) {
  281.         if (DoTreeObjMethod(group = GetChildHndl(root, --gnum), GETSELECTMESSAGE, 0)) {
  282.             if ((*group)->type == GROUPOBJ) {
  283.                 DoTreeSelect(group, SELECTOFF);
  284.                 for (cnum = (*group)->numChildren; cnum;) {
  285.                     MoveChild(UNGROUP_EDIT, group, --cnum, root, gnum + 1);
  286.                     DoTreeSelect(GetChildHndl(root, gnum + 1), SELECTON);
  287.                 }
  288.                 DisposeChild(UNGROUP_EDIT, root, gnum);
  289.             }
  290.         }
  291.     }
  292. }    
  293.  
  294.  
  295.  
  296. /*****************************************************************************/
  297. /*****************************************************************************/
  298. /*****************************************************************************/
  299.  
  300.  
  301.  
  302. #pragma segment DrawDoc
  303. void    AddOrSizeObj(FileRecHndl frHndl, TreeObjHndl hndl, ClickInfo *click)
  304. {
  305.     TreeObjHndl        root, cobj, origHndl, oldHndl;
  306.     WindowPtr        window;
  307.     short            cnum, h, w, i;
  308.     short            adding, extSelect;
  309.     LayerObj        wlyr, wklyr, blyr;
  310.     Rect            oldRct, newRct, rct, extRct1, extRct2, extRct3;
  311.     OSErr            err;
  312.     LayerDrawInfo    drawInfo;
  313.     Boolean            tool, keepTool, newTool;
  314.     Point            curMouse, org, oldOrg;
  315.  
  316.     root   = (*frHndl)->d.doc.root;
  317.     window = (*frHndl)->fileState.window;
  318.  
  319.     tool      = GetTool();
  320.     keepTool  = GetToolPersistence();
  321.     adding    = false;
  322.     extSelect = false;
  323.     newTool   = false;
  324.  
  325.     if (!hndl) {        /* If hndl == nil, then we are adding a new object. */
  326.         adding = true;
  327.         if (!tool)
  328.             extSelect = true;
  329.         else
  330.             DoTreeSelect(root, SELECTOFF);        /* Turn off all old selections. */
  331.  
  332.  
  333. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 979; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1065:1067)
  334.         hndl = NewChild(NEW_EDIT, root, cnum = 0, (RECTOBJ - 1) + tool, 0);
  335.  
  336.  
  337.         i = (extSelect) ? EXTSELECTOBJ : ((RECTOBJ - 1) + tool);
  338.         hndl = NewChild(NO_EDIT, root, cnum = 0, i, 0);
  339.  
  340.  
  341. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 991:996; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1079:1080)
  342.             DoTreeObjMethod(hndl, SETBBOXMESSAGE, (long)&rct);
  343.             DoTreeObjMethod(hndl, UNDOMESSAGE, UNDOFROMDOC);
  344.                 /* This is a safe (non-drawing) way to deselect the object.
  345.                 ** Just forcing the select field to false does not update
  346.                 ** the numSelected field in the root object.  We have to
  347.                 ** account for the deselection. */
  348.  
  349.             DoTreeObjMethod(hndl, SETOBJRECTMESSAGE, (long)&rct);
  350.             DoTreeObjMethod(hndl, SETSELECTMESSAGE, (SELECTOFF | SELECTNODRAW));
  351.  
  352.  
  353. Extra lines in 2nd before 1000 in 1st (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line Δ1000; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1084)
  354.         NewDocumentUndo(frHndl);
  355.  
  356.  
  357. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1002; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1087:1090)
  358.             /* Out of memory.  I would handle this case better if it weren't just sample code. */
  359.  
  360.             /* Out of memory.  I would handle this case better if it weren't just sample code.
  361.             ** Given that there are no complex objects, we actually can't run out of memory
  362.             ** due to this operation.  However, there may someday be a pixmap type of object,
  363.             ** whose memory hit could be substantial. */
  364.  
  365.  
  366. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1009:1017; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1097:1105)
  367.         NewLayer(&windowLayer, nil, WindowLayerProc, window, 0, (long)&drawInfo);
  368.         err = NewLayer(&workLayer, windowLayer, WorkLayerProc, nil, 0, (long)&drawInfo);
  369.         if (!err)
  370.             err = NewLayer(&backLayer, workLayer, BackLayerProc, nil, 0, (long)&drawInfo);
  371.         if (err) DisposeThisAndBelowLayers(workLayer);
  372.             /* The above code creates the necessary offscreen layers for the following editing.
  373.             ** The windowLayer is bound to succeed at getting created, as it uses the window,
  374.             ** instead of creating an offscreen GWorld.  The workLayer and backLayer creations
  375.             ** may fail.  If they do, then we will only have a windowLayer.  The windowLayer
  376.  
  377.         NewLayer(&wlyr, nil, WindowLayerProc, window, 0, (long)&drawInfo);
  378.         err = NewLayer(&wklyr, wlyr, WorkLayerProc, nil, 0, (long)&drawInfo);
  379.         if (!err)
  380.             err = NewLayer(&blyr, wklyr, BackLayerProc, nil, 0, (long)&drawInfo);
  381.         if (err) DisposeThisAndBelowLayers(wklyr);
  382.             /* The above code creates the necessary offscreen layers for the following editing.
  383.             ** The window layer is bound to succeed at getting created, as it uses the window,
  384.             ** instead of creating an offscreen GWorld.  The work layer and back layer creations
  385.             ** may fail.  If they do, then we will only have a window layer.  The window layer
  386.  
  387.  
  388. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1028; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1116)
  389.         InvalLayer(windowLayer, rct, true);
  390.  
  391.         InvalLayer(wlyr, rct, true);
  392.  
  393.  
  394. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1032:1051; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1120:1194)
  395.         while (StillDown()) {
  396.             DoTreeObjMethod(hndl, GETBBOXMESSAGE, (long)&oldRct);
  397.             if (DoTreeObjMethod(hndl, SIZEMESSAGE, (long)click)) {        /* If new size... */
  398.                 DoTreeObjMethod(hndl, GETBBOXMESSAGE, (long)&newRct);
  399.                 if (!err) {        /* If we have all offscreen layers... */
  400.                     if (click->grabber)
  401.                         InsetRect(&newRct, -3, -3);
  402.                     InvalLayer(windowLayer, newRct, true);
  403.                     UpdateLayer(windowLayer);
  404.                 }
  405.                 else {            /* If we only have windowLayer... */
  406.                     DoTreeObjMethod(hndl, SETBBOXMESSAGE, (long)&oldRct);
  407.                     DoTreeObjMethodClipped(hndl, DRAWMESSAGE, DRAWGHOST);
  408.                     DoTreeObjMethod(hndl, SETBBOXMESSAGE, (long)&newRct);
  409.                     DoTreeObjMethodClipped(hndl, DRAWMESSAGE, DRAWGHOST);
  410.                 }
  411.             }
  412.         }
  413.  
  414.         DoTreeObjMethod(hndl, GETBBOXMESSAGE, (long)&rct);
  415.  
  416.         origHndl = hndl;
  417.         HandToHand((Handle *)&origHndl);
  418.         while (StillDown()) {
  419.             DoTreeObjMethod(hndl, GETOBJRECTMESSAGE, (long)&oldRct);
  420.             oldHndl = hndl;
  421.             HandToHand((Handle *)&oldHndl);
  422.             if (DoTreeObjMethod(hndl, SIZEMESSAGE, (long)click)) {        /* If new size... */
  423.                 DoTreeObjMethod(hndl, GETOBJRECTMESSAGE, (long)&newRct);
  424.                 if (!err) {        /* If we have all offscreen layers... */
  425.                     DoTreeObjMethod(hndl, GETBBOXMESSAGE, (long)&rct);
  426.                     if (click->grabber)
  427.                         InsetRect(&rct, -3, -3);
  428.                     InvalLayer(wlyr, rct, true);
  429.                     UpdateLayer(wlyr);
  430.                 }
  431.                 else {            /* If we only have wlyr... */
  432.                     SwapTreeObjData(hndl, oldHndl);
  433.                     if (!EqualTreeObjData(hndl, origHndl))
  434.                         DoTreeObjMethodClipped(hndl, DRAWMESSAGE, DRAWGHOST);
  435.                     SwapTreeObjData(hndl, oldHndl);
  436.                     if (!EqualTreeObjData(hndl, origHndl))
  437.                         DoTreeObjMethodClipped(hndl, DRAWMESSAGE, DRAWGHOST);
  438.                 }
  439.             }
  440.             DisposeHandle((Handle)oldHndl);
  441.  
  442.             GetMouse(&curMouse);
  443.             GetContentRect(window, &rct);
  444.             if (!PtInRect(curMouse, &rct)) {
  445.  
  446.                 GetContentOrigin(window, &org);
  447.                 oldOrg = org;
  448.                 if (curMouse.h < rct.left)   org.h += (curMouse.h - rct.left);
  449.                 if (curMouse.h > rct.right)  org.h += (curMouse.h - rct.right);
  450.                 if (curMouse.v < rct.top)    org.v += (curMouse.v - rct.top);
  451.                 if (curMouse.v > rct.bottom) org.v += (curMouse.v - rct.bottom);
  452.  
  453.                 rct = GetDataArea(root);
  454.                 if (rct.right < curMouse.h)
  455.                     rct.right = curMouse.h;
  456.                 if (rct.bottom < curMouse.v)
  457.                     rct.bottom = curMouse.v;
  458.                 SetDataArea(root, rct.right, rct.bottom);
  459.  
  460.                 SetContentOrigin(window, org.h, org.v);
  461.                 GetContentOrigin(window, &org);
  462.  
  463.                 if (!err) {
  464.                     if ((org.h != oldOrg.h) || (org.v != oldOrg.v)) {
  465.                         DisposeThisAndBelowLayers(wlyr);
  466.                         DoImageDocument(frHndl);
  467.                         NewLayer(&wlyr, nil, WindowLayerProc, window, 0, (long)&drawInfo);
  468.                         err = NewLayer(&wklyr, wlyr, WorkLayerProc, nil, 0, (long)&drawInfo);
  469.                         if (!err)
  470.                             err = NewLayer(&blyr, wklyr, BackLayerProc, nil, 0, (long)&drawInfo);
  471.                         if (err) DisposeThisAndBelowLayers(wklyr);
  472.                         GetContentRect(window, &rct);
  473.                         InvalLayer(wlyr, rct, false);    /* Force full redraw. */
  474.                     }
  475.                 }
  476.                 else
  477.                     DoImageDocument(frHndl);
  478.             }
  479.             else {
  480.                 rct = GetDataArea(root);
  481.                 SetDataArea(root, rct.right, rct.bottom);
  482.             }
  483.         }
  484.         if (origHndl)
  485.             DisposeHandle((Handle)origHndl);
  486.  
  487.         rct = GetDataArea(root);
  488.         SetDataArea(root, rct.right, rct.bottom);
  489.  
  490.         DoTreeObjMethod(hndl, GETOBJRECTMESSAGE, (long)&rct);
  491.  
  492.  
  493. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1061:1062; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1204:1205)
  494.                 RevertEdit(hndl);        /* Don't create a new object that's too small. */
  495.                 hndl = nil;                /* We didn't change anything, so flag this situation. */
  496.  
  497.                 DisposeChild(NO_EDIT, root, 0);        /* Don't create a new object that's too small. */
  498.                 hndl = nil;                    /* We didn't change anything, so flag this situation.  */
  499.  
  500.  
  501. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1069; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1212)
  502.                 DoTreeObjMethod(hndl, SETBBOXMESSAGE, (long)&rct);    /* Make it minimum. */
  503.  
  504.                 DoTreeObjMethod(hndl, SETOBJRECTMESSAGE, (long)&rct);    /* Make it minimum. */
  505.  
  506.  
  507. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1075:1086; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1218:1274)
  508.             SetWindowDirty(window);
  509.             if (err)
  510.                 DoTreeObjMethod(hndl, DRAWMESSAGE, DRAWOBJ);
  511.                     /* If we have only a windowLayer, then we haven't really been generating a
  512.                     ** complete image.  Redraw the document so that a full image is shown. */
  513.             DoTreeSelect(hndl, SELECTON);
  514.                 /* Make sure the object is selected. */
  515.         }
  516.  
  517.         DisposeThisAndBelowLayers(windowLayer);        /* Clean up. */
  518.     }
  519.  
  520.  
  521.  
  522.  
  523.             if (adding) {        /* If we are adding, we haven't handled posting the addition
  524.                                 ** for undo.  The reason for this is that the user may not
  525.                                 ** actually add an object.  If they just click and release,
  526.                                 ** there is no object added.  If we add the child with undo
  527.                                 ** posting, and then remove it if the user doesn't grow it
  528.                                 ** out, then we may lose some old undo info.  If the user
  529.                                 ** doesn't grow out the object, the operation is a NOP, and
  530.                                 ** so old undo information shouldn't be lost. */
  531.                 if (extSelect) {                            /* We only created the object for extend-select purposes. */
  532.                     DoTreeObjMethod(hndl, GETBBOXMESSAGE, (long)&extRct1);
  533.                     for (i = (*root)->numChildren - 1; i; --i) {
  534.                         cobj = GetChildHndl(root, i);
  535.                         DoTreeObjMethod(cobj, GETBBOXMESSAGE, (long)&extRct2);
  536.                         SectRect(&extRct1, &extRct2, &extRct3);
  537.                         if (EqualRect(&extRct2, &extRct3))
  538.                             DoTreeObjMethodClipped(cobj, SETSELECTMESSAGE, SELECTTOGGLE);
  539.                     }
  540.                     DisposeChild(NO_EDIT, root, 0);            /* We're done with it, so kill it. */
  541.                 }
  542.                 else {
  543.                     NewDocumentUndo(frHndl);
  544.                     hndl = CopyChild(NEW_EDIT, root, 0, root, 0, false);
  545.                     DisposeChild(NO_EDIT, root, 1);
  546.                 }    /* We just created a posted copy of the child, just as if we had called
  547.                     ** NewChild.  We also disposed of the temporary unposted copy of the child.
  548.                     ** The only problem is that objects entering the document get flagged as
  549.                     ** selected.  This means that when we select the object, nothing happens
  550.                     ** on the screen because the object thinks it is already selected. */
  551.                 if (!extSelect)
  552.                     if (hndl)
  553.                         DoTreeObjMethod(hndl, SETSELECTMESSAGE, (SELECTOFF | SELECTNODRAW));
  554.                             /* Now the select grabbers can be drawn. */
  555.             }
  556.  
  557.             rct = GetDataArea(root);
  558.             SetDataArea(root, rct.right, rct.bottom);
  559.  
  560.             SetWindowDirty(window);
  561.             if (err)
  562.                 DoImageDocument(frHndl);
  563.                     /* If we have only a wlyr, then we haven't really been generating a
  564.                     ** complete image.  Redraw the document so that a full image is shown. */
  565.  
  566.             if (!extSelect)
  567.                 DoTreeObjMethodClipped(hndl, SETSELECTMESSAGE, SELECTON);
  568.                     /* Make sure the object is selected. */
  569.         }
  570.  
  571.         DisposeThisAndBelowLayers(wlyr);        /* Clean up. */
  572.     }
  573.  
  574.     if (extSelect)
  575.         DoImageDocument(frHndl);
  576.             /* Since we have killed the extend-select object, erase it from the screen. */
  577.  
  578.  
  579.  
  580. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1121; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1309)
  581.                 ** By setting the dstRect to this smaller rect, workLayer and backLayer
  582.  
  583.                 ** By setting the dstRect to this smaller rect, work layer and back layer
  584.  
  585.  
  586. Extra lines in 2nd before 1144 in 1st (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line Δ1144; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1332)
  587.                 DrawPageGrid();
  588.  
  589.  
  590. Extra lines in 2nd before 1196 in 1st (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line Δ1196; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1385)
  591.             DrawPageGrid();
  592.  
  593.  
  594. Extra lines in 2nd before 1236 in 1st (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line Δ1236; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1426:1429)
  595.                 for (cnum = (*drawInfo.root)->numChildren - 1;  cnum > drawInfo.cnum; --cnum) {
  596.                     chndl = GetChildHndl(drawInfo.root, cnum);
  597.                     DoTreeDraw(chndl, DRAWSELECT);
  598.                 }
  599.  
  600.  
  601. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1255:1264; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1449:1495)
  602. void    SlideSelection(FileRecHndl frHndl, ClickInfo *click)
  603. {
  604.     LayerDrawInfo    drawInfo;
  605.     WindowPtr        window;
  606.     LayerObj        windowLayer, workLayer, backLayer;
  607.     Point            lastMouse, curMouse;
  608.     short            cnum;
  609.     TreeObjHndl        root, chndl;
  610.     Rect            newLoc, selectRct;
  611.     Boolean            changed;
  612.  
  613. void    DrawPageGrid(void)
  614. {
  615.     WindowPtr    curPort;
  616.     short        x1, x2, y1, y2, i;
  617.  
  618.     if (!gPrintPage) {
  619.         GetPort(&curPort);
  620.         PenPat((ConstPatternParam)&qd.gray);
  621.         x1  = curPort->portRect.left   / (7 * 72);
  622.         x1 *= (7 * 72);
  623.         x2  = curPort->portRect.right  / (7 * 72);
  624.         x2 *= (7 * 72);
  625.         y1  = curPort->portRect.top    / (10 * 72);
  626.         y1 *= (10 * 72);
  627.         y2  = curPort->portRect.bottom / (10 * 72);
  628.         y2 *= (10 * 72);
  629.         for (i = x1; i <= x2; i += (7 * 72)) {
  630.             MoveTo(i - 1, -1);
  631.             Line  (0, 16383);
  632.         }
  633.         for (i = y1; i <= y2; i += (10 * 72)) {
  634.             MoveTo(-1, i - 1);
  635.             Line  (16383, 0);
  636.         }
  637.         PenNormal();
  638.     }
  639. }
  640.  
  641.  
  642.  
  643. /*****************************************************************************/
  644.  
  645.  
  646.  
  647. #pragma segment DrawDoc
  648. void    SlideSelection(FileRecHndl frHndl, ClickInfo *click)
  649. {
  650.     LayerDrawInfo    drawInfo;
  651.     WindowPtr        window;
  652.     LayerObj        wlyr, wklyr, blyr;
  653.     Point            lastMouse, curMouse;
  654.     short            cnum;
  655.     TreeObjHndl        root, chndl;
  656.     Rect            newLoc, selectRct, rct;
  657.     Point            oldOrg, org;
  658.     Boolean            changed;
  659.     OSErr            err;
  660.  
  661.  
  662. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1279:1281; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1510:1512)
  663.     NewLayer(&windowLayer, nil, WindowLayerProc, window, 0, (long)&drawInfo);
  664.     NewLayer(&workLayer, windowLayer, WorkLayerProc, nil, 0, (long)&drawInfo);
  665.     NewLayer(&backLayer, workLayer, BackLayerProc, nil, 0, (long)&drawInfo);
  666.  
  667.                     NewLayer(&wlyr, nil, WindowLayerProc, window, 0, (long)&drawInfo);
  668.               err = NewLayer(&wklyr, wlyr, WorkLayerProc, nil, 0, (long)&drawInfo);
  669.     if (!err) err = NewLayer(&blyr, wklyr, BackLayerProc, nil, 0, (long)&drawInfo);
  670.  
  671.  
  672. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1285; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1516)
  673.     InvalLayer(windowLayer, selectRct, false);
  674.  
  675.     InvalLayer(wlyr, selectRct, false);
  676.  
  677.  
  678. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1301; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1532)
  679.                     InvalLayer(windowLayer, newLoc, true);
  680.  
  681.                     InvalLayer(wlyr, newLoc, true);
  682.  
  683.  
  684. Nonmatching lines (File "b:-archives:93/03/25.Dev.CD.Version:AppsToGo.CD:DTS.Draw:Window.c"; Line 1304:1311; File "a:Desktop Folder:AppsToGo.src:DTS.Draw:Window.c"; Line 1535:1581)
  685.             UpdateLayer(windowLayer);
  686.             lastMouse = curMouse;
  687.         }
  688.     }
  689.  
  690.     if (changed)
  691.         SetWindowDirty(window);
  692.     DisposeThisAndBelowLayers(windowLayer);
  693.  
  694.             UpdateLayer(wlyr);
  695.             lastMouse = curMouse;
  696.  
  697.             GetContentRect(window, &rct);
  698.             if (!PtInRect(curMouse, &rct)) {
  699.  
  700.                 GetContentOrigin(window, &org);
  701.                 oldOrg = org;
  702.                 if (curMouse.h < rct.left)   org.h += (curMouse.h - rct.left);
  703.                 if (curMouse.h > rct.right)  org.h += (curMouse.h - rct.right);
  704.                 if (curMouse.v < rct.top)    org.v += (curMouse.v - rct.top);
  705.                 if (curMouse.v > rct.bottom) org.v += (curMouse.v - rct.bottom);
  706.  
  707.                 rct = GetDataArea(root);
  708.                 if (rct.right < curMouse.h)
  709.                     rct.right = curMouse.h;
  710.                 if (rct.bottom < curMouse.v)
  711.                     rct.bottom = curMouse.v;
  712.                 SetDataArea(root, rct.right, rct.bottom);
  713.  
  714.                 SetContentOrigin(window, org.h, org.v);
  715.                 GetContentOrigin(window, &org);
  716.                 if ((org.h != oldOrg.h) || (org.v != oldOrg.v)) {
  717.                     DisposeThisAndBelowLayers(wlyr);
  718.                     DoImageDocument(frHndl);
  719.                                     NewLayer(&wlyr, nil, WindowLayerProc, window, 0, (long)&drawInfo);
  720.                               err = NewLayer(&wklyr, wlyr, WorkLayerProc, nil, 0, (long)&drawInfo);
  721.                     if (!err) err = NewLayer(&blyr, wklyr, BackLayerProc, nil, 0, (long)&drawInfo);
  722.                     if (err) DisposeThisAndBelowLayers(wklyr);
  723.                     GetContentRect(window, &rct);
  724.                     InvalLayer(wlyr, rct, false);    /* Force full redraw. */
  725.                 }
  726.             }
  727.             else {
  728.                 rct = GetDataArea(root);
  729.                 SetDataArea(root, rct.right, rct.bottom);
  730.             }
  731.         }
  732.     }
  733.  
  734.     rct = GetDataArea(root);
  735.     SetDataArea(root, rct.right, rct.bottom);
  736.  
  737.     if (changed)
  738.         SetWindowDirty(window);
  739.  
  740.     DisposeThisAndBelowLayers(wlyr);
  741.  
  742.  
  743. *** EOF on both files at the same time ***
  744.